import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Scanner;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextPane;


public class ChatPanel extends JPanel {
	private Color bg = new Color(43, 43, 43);
	protected JTextArea ta;
	protected JTextPane tp;
	protected String tps;
	protected PrintStream outfile;
	protected Scanner infile;
	protected Color myColor;
	protected JButton clear;
	protected String divider = "\n---------------------------------";

	public ChatPanel() {
		tps = "";

		this.setLayout(new BorderLayout());
		this.setPreferredSize(new Dimension(750, 200));
		this.setBorder(BorderFactory.createCompoundBorder(BorderFactory
				.createMatteBorder(5, 0, 5, 0, Color.white), BorderFactory
				.createMatteBorder(15, 15, 15, 15, bg)));



		tp = new JTextPane();
		tp.setEditable(false);
		JScrollPane sp1 = new JScrollPane(tp);
		sp1.getVerticalScrollBar().setBackground(myColor);
		sp1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
		sp1.setPreferredSize(new Dimension(25, 200));
		sp1.setBounds(400, 0, 50, 200);
		this.add(sp1, BorderLayout.CENTER);
		
		ta = new JTextArea(1, 4);
		ta.setPreferredSize(new Dimension(50, 35));
		ta.setEditable(true);
		ta.setLineWrap(true);
		ta.addKeyListener(new AreaKeyListener());
		ta.setBorder(BorderFactory.createMatteBorder(15, 0, 0, 0, bg));
		this.add(ta, BorderLayout.SOUTH);
		


	
		tp.setText(tps);

	}

	private class AreaKeyListener implements KeyListener {
		public void keyTyped(KeyEvent e) {
		}
		public void keyPressed(KeyEvent e) {
			if (e.getKeyCode() == KeyEvent.VK_ENTER) {
			}
		}
		public void keyReleased(KeyEvent e) {
			if (e.getKeyCode() == KeyEvent.VK_ENTER)
				ta.setText("");
		}
	}

}
